﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ApprovalFlow.Models
{
    public class StartStepDescription : StepDescription
    {
        public override IEnumerable<ExecutionPointer> Builder(WorkflowInstance instance, ExecutionPointer master)
        {
            List<ExecutionPointer> pointers = new List<ExecutionPointer>();
            ExecutionPointer pointer = new ExecutionPointer
            {
                Id = this.Id,
                Active = true,
                PredecessorId = master?.Id,
                InstanceId = instance.InstanceId,
                StepName = "发起申请",
                Processor = "startEvent"
            };

            pointers.Add(pointer);

            if (this.ChildNode is not null)
            {
                pointers.AddRange(this.ChildNode.Builder(instance, pointer));
            }
            return pointers;
        }
    }
}
